package http

type ResCode int64

// 错误响应状态码
const (
	CodeError404   ResCode = 404
	CodeServerBusy ResCode = 503
	CodeKeyIsEmpty ResCode = 600 + iota
	CodeInvalidParam
)

// 成功响应状态码
const (
	CodeSuccess ResCode = 200
)

// 状态码名称
var codeMsgMap = map[ResCode]string{
	CodeError404:     "404：页面不存在",
	CodeServerBusy:   "服务繁忙",
	CodeKeyIsEmpty:   "key值为空",
	CodeInvalidParam: "无效的参数",

	CodeSuccess: "success",
}

func (rc ResCode) Msg() string {
	msg, ok := codeMsgMap[rc]
	if !ok {
		return codeMsgMap[CodeServerBusy]
	}
	return msg
}
